function LRUCache(casity) {
    this.casity = casity
    this.cache = new Map()
}

LRUCache.prototype.get = function(key) {
    if(this.cache.has(key)) {
        let temp = this.cache.get(key)
        this.cache.delete(key)
        this.cache.set(key, temp)
        return temp
    }
    return -1
}

LRUCache.prototype.put = function(key, value) {
    if(this.cache.has(key)) {
        this.cache.delete(key)
    }
    else if(this.cache.size === this.casity) {
        this.cache.delete(this.cache.keys().next().value)
    }
    this.cache.set(key, value)
}